After refusing to leave office this week, Samangan Governor Abdulkarim Khaddam agreed to go under a deal between his Jamiat-i Islami party and Ghani's office in Kabul, party officials said. In exchange, Khaddam will take a position on the High Peace Council, a body set up to handle reconciliation efforts with the Taliban.
New Governor Abdul Latif Ibrahimi took office in Samangan, while the two sides agreed that Khaddam's deputy Ziauddin Zia would remain in place. "It is my right to be in this position," Zia told reporters.
However large groups of armed men gathered near the governor's compound in the capital Aibak to try to force Zia out as local elders sought to calm the situation.
"I am the new deputy governor and I will not let anyone else take this job. I have my armed men here," said Sefatullah Samangani, a provincial council member from the rival Junbish-i Milli party who was named as Zia's replacement before Tuesday's compromise.
With Taliban fighters active across much of the country and the capital Kabul regularly hit by devastating suicide attacks, the dispute in Samangan has highlighted the divisions undermining Ghani's government ahead of parliamentary elections scheduled this year.
While nominally partners in the national unity government created after the disputed 2014 presidential election, Ghani's relations with Jamiat have deteriorated sharply, while ethnic divisions have become increasingly bitter.
The divisions have been deepened by the prolonged standoff between Ghani and Balkh Governor Atta Mohammad Noor, one of the most senior politicians in Jamiat and a possible rival to Ghani in next year's presidential election.